package com.gwnet.shop.service.impl;

import java.util.List;

import com.gwnet.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gwnet.shop.mapper.FeeStandardMapper;
import com.gwnet.shop.domain.FeeStandard;
import com.gwnet.shop.service.IFeeStandardService;

import javax.annotation.Resource;

/**
 * 配送费用收费标准Service业务层处理
 * 
 * @author zhangwanpeng
 * @date 2024-08-06
 */
@Service
public class FeeStandardServiceImpl implements IFeeStandardService 
{
    @Resource
    private FeeStandardMapper feeStandardMapper;

    /**
     * 查询配送费用收费标准
     * 
     * @param id 配送费用收费标准主键
     * @return 配送费用收费标准
     */
    @Override
    public FeeStandard selectFeeStandardById(Long id)
    {
        return feeStandardMapper.selectFeeStandardById(id);
    }

    /**
     * 查询配送费用收费标准列表
     * 
     * @param feeStandard 配送费用收费标准
     * @return 配送费用收费标准
     */
    @Override
    public List<FeeStandard> selectFeeStandardList(FeeStandard feeStandard)
    {
        return feeStandardMapper.selectFeeStandardList(feeStandard);
    }

    /**
     * 新增配送费用收费标准
     * 
     * @param feeStandard 配送费用收费标准
     * @return 结果
     */
    @Override
    public int insertFeeStandard(FeeStandard feeStandard)
    {
        feeStandard.setCreateTime(DateUtils.getNowDate());
        return feeStandardMapper.insertFeeStandard(feeStandard);
    }

    /**
     * 修改配送费用收费标准
     * 
     * @param feeStandard 配送费用收费标准
     * @return 结果
     */
    @Override
    public int updateFeeStandard(FeeStandard feeStandard)
    {
        feeStandard.setUpdateTime(DateUtils.getNowDate());
        return feeStandardMapper.updateFeeStandard(feeStandard);
    }

    /**
     * 批量删除配送费用收费标准
     * 
     * @param ids 需要删除的配送费用收费标准主键
     * @return 结果
     */
    @Override
    public int deleteFeeStandardByIds(Long[] ids)
    {
        return feeStandardMapper.deleteFeeStandardByIds(ids);
    }

    /**
     * 删除配送费用收费标准信息
     * 
     * @param id 配送费用收费标准主键
     * @return 结果
     */
    @Override
    public int deleteFeeStandardById(Long id)
    {
        return feeStandardMapper.deleteFeeStandardById(id);
    }

    /**
     * 根据订单金额查询 平台的配型费用
     * @param money
     * @return
     */
    @Override
    public double getDeliveryAmount(Double money) {
        return feeStandardMapper.getAmount(money);
    }
}
